Rendering Problems Missing styles. Is the correct theme chosen for this layout?

您所在的位置:网站首页 rendering problem Rendering Problems Missing styles. Is the correct theme chosen for this layout?

Rendering Problems Missing styles. Is the correct theme chosen for this layout?

2024-07-13 19:37| 来源: 网络整理| 查看: 265

今天用AndroidStudio导入项目的时候一个比较坑的问题,导入项目在预览layout布局文件的时候出现了这样的提示: Rendering Problems Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style ‘textViewStyle’ in current theme (4 similar errors not shown) Tip: Try to refresh the layout.

详情如图: 这里写图片描述

并且查看style.xml文件的时候,主题样式提示找不到,提示信息如下: Cannot resolve symbol ‘Theme.AppCompat.Light.DarkActionBar’ 详情如下图: 这里写图片描述

后来网上查找解决办法是: layout预览界面(Graphic Layout),右上角有个Theme的选择项,默认为notitle,根据喜好随意设定值,我们这里设定为android以前默认的Theme.black. 但是没解决我的问题。

最后无意间找到了问题原因:是由于工程下面的build.gradle里面的版本和本地的版本不一致造成的,详情如图: 这里写图片描述

项目里面的gradle版本是2.3.0,而我自己本地的gradle版本是2.2.3,导致layout布局预览出现警告,只要将gradle的版本改了和本地的一致就OK了。

这里写图片描述 这里写图片描述

这样就搞定了



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3